<?php
require_once(dirname(__FILE__)."/../include/db_mysql.php");

function insert_user_reg($email, $username, $password)
{
	$sql = new SqlClass;
	//连接数据库
	$sql->connect();
	//执行sql语句

	//先检验用户名是否已被注册
    $sql_command = "SELECT * FROM `user` where userName='$username';";
    $r = $sql->exec_sql( $sql_command );
	$row = mysql_fetch_array($r);
	if( $row != '' )  //说明该用户名已被注册
	{
		return false;
	}

    //说明用户名未被注册
    $sql_command = "INSERT INTO  `user` (
`userName` ,
`email` ,
`password`
)
VALUES (
'$username',  '$email',  '$password'
);";
    $r = $sql->exec_sql( $sql_command );//保存执行sql的结果
	//关闭数据库
	$sql->close();

	return true;


}
?>